<template>
	<view class='content'>
		<div class='row_head'>
			<div class='row_price'>
				<text style="font-size: 20px;">￥</text>
				<text style="margin:0 10upx">{{price}}</text>
				<text style="font-size: 20px;">元</text>
			</div>
			<div class='row_type'>
				<text>订单类型：</text>
				<text v-if='type=="meal"'>{{cardNumber}} 订购套餐</text>
				<text v-if='type=="balance"'>{{cardNumber}} 充值余额</text>
				<text v-if='type=="post"'>支付邮费（换卡{{ids.length}}张）</text>
			</div>
		</div>
		<radio-group name="radio" @change='changePayWay' size='small'>
			<div v-for='item in payway' class='row_payway' v-if='item.children.length>0'>
				<div class='row_payway_head'>
					<svg t="1605165647587" v-if='item.type == "WXZF"' class="icon" viewBox="0 0 1024 1024"
					 version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="21587" width="32" height="32">
						<path d="M395.846 603.585c-3.921 1.98-7.936 2.925-12.81 2.925-10.9 0-19.791-5.85-24.764-14.625l-2.006-3.864-78.106-167.913c-0.956-1.98-0.956-3.865-0.956-5.845 0-7.83 5.928-13.68 13.863-13.68 2.965 0 5.928 0.944 8.893 2.924l91.965 64.43c6.884 3.864 14.82 6.79 23.708 6.79 4.972 0 9.85-0.945 14.822-2.926L861.71 282.479c-77.149-89.804-204.684-148.384-349.135-148.384-235.371 0-427.242 157.158-427.242 351.294 0 105.368 57.361 201.017 147.323 265.447 6.88 4.905 11.852 13.68 11.852 22.45 0 2.925-0.957 5.85-2.006 8.775-6.881 26.318-18.831 69.334-18.831 71.223-0.958 2.92-2.013 6.79-2.013 10.75 0 7.83 5.929 13.68 13.865 13.68 2.963 0 5.928-0.944 7.935-2.925l92.922-53.674c6.885-3.87 14.82-6.794 22.756-6.794 3.916 0 8.889 0.944 12.81 1.98 43.496 12.644 91.012 19.53 139.48 19.53 235.372 0 427.24-157.158 427.24-351.294 0-58.58-17.78-114.143-48.467-163.003l-491.39 280.07-2.963 1.98z"
						 fill="#09BB07" p-id="21588"></path>
					</svg>
					<svg t="1605165521664" v-if='item.type == "ZFBZF"' class="icon" ids.lengthviewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
					 p-id="21443" width="32" height="32">
						<path d="M902.095 652.871l-250.96-84.392s19.287-28.87 39.874-85.472c20.59-56.606 23.539-87.689 23.539-87.689l-162.454-1.339v-55.487l196.739-1.387v-39.227H552.055v-89.29h-96.358v89.294H272.133v39.227l183.564-1.304v59.513h-147.24v31.079h303.064s-3.337 25.223-14.955 56.606c-11.615 31.38-23.58 58.862-23.58 58.862s-142.3-49.804-217.285-49.804c-74.985 0-166.182 30.123-175.024 117.55-8.8 87.383 42.481 134.716 114.728 152.139 72.256 17.513 138.962-0.173 197.04-28.607 58.087-28.391 115.081-92.933 115.081-92.933l292.486 142.041c-11.932 69.3-72.067 119.914-142.387 119.844H266.37c-79.714 0.078-144.392-64.483-144.466-144.194V266.374c-0.074-79.72 64.493-144.399 144.205-144.47h491.519c79.714-0.073 144.396 64.49 144.466 144.203v386.764z m-365.76-48.895s-91.302 115.262-198.879 115.262c-107.623 0-130.218-54.767-130.218-94.155 0-39.34 22.373-82.144 113.943-88.333 91.519-6.18 215.2 67.226 215.2 67.226h-0.047z"
						 fill="#02A9F1" p-id="21444"></path>
					</svg>
					<svg t="1605165672634" v-if='item.type == "UPSMZF"' class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
					 p-id="21731" width="32" height="32">
						<path d="M229.643 233.89c-26.054 3.28-52.107 24.846-60.636 49.688-5.683 15.47-107.536 454.219-108.005 462.19-0.949 22.968 12.314 39.844 34.104 44.064 8.055 1.874 266.703 1.874 275.232 0 24.631-4.69 47.843-23.908 56.372-47.345 3.316-8.906 108.48-456.093 108.48-463.595 1.422-21.096-11.372-38.44-31.738-44.533-4.739-0.934-262.912-1.874-273.81-0.47z"
						 fill="#E60012" p-id="21732"></path>
						<path d="M470.762 233.89c-26.054 3.28-52.107 24.846-60.632 49.688-5.214 15.47-107.534 454.219-107.534 462.19-0.95 22.968 12.314 39.844 34.108 44.064 8.05 1.874 266.698 1.874 275.227 0 24.635-4.69 47.847-23.908 56.372-47.345 3.317-8.906 108.479-456.093 108.479-463.595 1.424-21.096-11.366-38.44-31.736-44.533-5.214-0.934-263.387-1.874-274.284-0.47z"
						 fill="#00508E" p-id="21733"></path>
						<path d="M722.308 233.89c-26.054 3.28-52.112 24.846-60.637 49.688-5.209 15.47-107.534 454.219-107.534 462.19-0.945 22.968 12.32 39.844 34.108 44.064 8.055 1.874 200.383 1.874 208.908 0 24.634-4.69 47.847-23.908 56.372-47.345 3.316-8.906 108.484-456.093 108.484-463.595 1.418-21.096-11.371-38.44-31.743-44.533-4.734-1.404-220.748-2.343-231.645-0.934h23.687v0.465z"
						 fill="#00908C" p-id="21734"></path>
						<path d="M221.589 376.39c0 0.47-0.476 3.282-1.42 6.095-10.896 36.562-21.793 85.781-20.37 91.874 3.79 18.283 30.793 16.876 40.266-2.343 2.842-5.154 23.212-90.936 23.212-97.028 0-0.47 32.212 0 32.212 0.464 0 0 0 1.408-0.475 2.817-0.474 1.403-5.683 21.091-11.366 44.529-12.795 49.688-14.213 54.842-20.845 64.686-21.793 31.878-94.746 30.94-100.429-1.404-1.422-7.032 14.213-88.124 21.32-110.159 0-1.403 37.895-0.469 37.895 0.47z m484.139 0c21.79 4.69 28.42 22.03 18.472 47.816-9.947 25.78-31.262 37.028-68.686 37.028-11.371 0-10.423-1.874-17.529 33.282-1.419 6.562-2.841 12.656-2.841 13.594-0.476 2.343-34.11 2.343-33.635 0 28.426-120.468 30.793-130.78 30.793-131.72l0.474-1.402h34.104c27.003 0.464 34.583 0.464 38.848 1.403z m-292.282 46.408c4.735 0.938 8.05 4.69 8.05 7.97 0 11.717-24.16 19.688-33.16 10.779-8.525-8.905 9.475-22.5 25.11-18.75z m-83.849 8.904c0 0.94-0.474 2.817-0.474 4.22l-0.474 1.878 5.683-2.816c15.16-7.497 29.844-6.094 34.583 3.281 2.841 5.629 2.367 8.91-5.21 43.595-1.422 6.094-3.315 14.534-3.79 18.748-1.897 9.38-0.474 8.91-17.528 8.91-14.687 0-14.687 0-14.212-1.408 0-0.938 1.896-8.435 3.79-17.345 7.58-33.277 8.055-37.967 1.422-37.967-3.79 0-9.004 2.343-9.473 3.75-0.948 3.282-9.478 44.06-9.952 47.812l-0.945 4.22-14.687 0.938c-17.998 0.47-16.58 1.873-12.79-14.064 5.21-20.626 8.055-35.154 9.949-48.28 2.367-14.063 0.948-12.655 14.212-14.532 6.158-0.94 12.315-1.874 14.213-2.343 4.735-1.409 5.683-0.94 5.683 1.403z m225.014-0.464c0 0.933-0.474 2.811-0.474 4.216l-0.476 2.346 5.688-2.816c29.37-14.998 40.737-2.813 32.212 35.628-1.893 8.436-4.265 20.623-5.683 26.25-0.949 6.094-2.372 11.248-2.842 11.717-1.898 1.874-29.844 1.41-29.375 0 0-0.938 1.898-8.435 3.791-16.875 8.056-34.216 8.056-38.436 0.949-38.436-5.683 0-8.525 1.873-9.473 6.092-1.424 5.155-8.53 38.906-9.475 45l-0.948 5.158-14.687 0.47c-17.999 0.465-16.58 2.342-12.316-15.003 4.74-18.75 8.056-36.094 10.423-48.749 1.893-12.187 0.474-10.782 12.315-12.656 5.213-0.938 11.846-1.878 14.214-2.342 4.738-2.348 6.157-1.878 6.157 0z m287.547-0.47c1.892 28.592 2.368 37.028 2.368 37.498 0 0.47 4.264-7.032 8.999-16.406 9.473-18.749 7.58-16.876 18.002-18.28 2.842-0.469 8.525-1.409 12.79-2.342 10.423-1.878 10.423-2.817-1.423 17.81-16.105 27.658-38.368 66.564-46.423 80.627-24.157 43.591-24.157 43.591-44.527 44.06l-12.316 0.47 0.945-3.282c0.474-1.873 1.897-5.623 2.37-8.435l1.42-5.159h3.79c4.265 0 5.209-0.94 9-7.502 1.423-2.342 3.79-6.093 4.738-8.435 1.42-2.343 6.158-9.844 9.949-17.345l7.58-13.125-1.897-17.34c-2.367-20.158-5.209-44.065-6.631-51.097-0.95-6.562-0.95-6.562 7.58-7.5 3.79-0.466 9.948-1.874 13.264-2.343 8.999-2.812 9.947-2.812 10.422-1.874z m-357.183 0.47c36.476 6.562 23.686 69.37-16.106 78.28-27.003 6.094-45.475-4.22-45.475-24.847 0.47-36.093 27.472-59.53 61.58-53.433z m272.86 1.873c1.893 0.938 4.739 2.812 6.158 4.22 2.367 2.342 2.367 2.342 2.367 0.934 0.475-1.873 0-1.873 18.951-4.685 15.158-2.342 14.684-2.342 13.739 1.874-6.158 26.249-11.371 49.217-13.739 60.47-3.315 16.876-0.948 14.998-19.421 14.529h-15.635v-1.874c0-1.873-0.945-2.812-1.894-1.407-5.213 8.44-30.792 5.158-37.898-5.155-17.525-26.25 19.896-81.562 47.371-68.906z m-340.129 13.595s0 2.342-0.474 4.219c-3.786 14.999-10.418 45.469-11.842 51.092l-1.422 7.032-15.632 0.469c-18.472 0.47-17.528 1.404-13.738-9.843 3.316-10.783 6.633-23.908 8.53-37.972 1.892-12.186 0-10.313 13.738-12.186 6.157-0.94 12.79-1.873 14.208-2.342 3.79-0.939 6.158-0.939 6.632-0.47z m82.9 97.028c0 0.47-0.944 2.348-2.367 4.69-0.95 2.342-2.367 4.22-2.367 4.22 27.946 0.464 28.895 0.464 28.42 1.873l-5.209 16.876h-40.74l-2.367 1.873c-5.214 4.689-32.686 10.782-32.686 7.031l5.21-16.875h3.789c6.632 0 8.05-1.404 13.738-11.247l4.735-8.91c24.636-0.465 29.843 0 29.843 0.47z m62.06 0c0 0.47-0.475 2.812-1.424 5.629-0.948 2.342-1.417 4.685-1.417 5.154 0 0 2.366-0.94 5.207-3.28 10.423-7.033 19.422-8.437 45.95-8.437 10.423 0 19.422 0 19.896 0.465 0.475 0.939-15.156 51.565-17.528 56.25-3.316 6.098-6.633 9.379-11.84 11.721l-4.74 1.874-26.998 0.47-27.003 0.468-4.738 15.937c-9.474 30.47-9.474 28.128 4.264 26.72 10.897-0.94 10.423-1.873 7.107 9.374l-2.842 9.375h-13.738c-29.844 0.47-33.634-1.404-30.793-13.594 1.423-6.094 35.528-117.656 36.002-118.595 0.474-0.465 24.635-0.465 24.635 0.47z m124.584 0c0 0.47-0.474 1.877-0.944 3.75-1.423 4.69-1.423 4.69 4.735 1.41 8.054-4.221 27.002-5.629 65.845-5.629h12.32v5.629c0 6.562 0.475 7.03 6.158 7.966l4.264 0.469-2.372 8.44-2.366 8.435h-8.53c-21.789 0.47-25.104-1.873-25.58-14.528v-6.098l-1.418 4.22-1.423 4.69H733.2c-2.367 0-4.735 0-4.735 0.47 0 0-23.211 76.401-26.528 87.184-0.474 0.94 0 1.409 2.843 1.409 4.264 0 4.264 0 2.841 3.745-1.419 4.221-1.419 4.221 3.316 4.221 3.316 0 5.214-0.47 7.58-1.873 3.317-1.878 3.317-1.408 18.473-22.5l6.158-8.909h-12.79c-15.631 0-14.207 0.939-11.366-8.435l2.367-7.502h31.268c2.841-9.844 3.785-12.656 3.785-13.125 0-0.47-6.632-0.47-15.156-0.47h-15.158l4.735-16.875h42.633c23.212 0 42.638 0 42.638 0.47 0 0.469-0.948 4.22-2.37 8.44l-2.368 7.966-14.213 0.469-14.21 0.469c-2.37 7.032-3.315 10.313-3.789 11.252l-0.474 1.873h13.738c16.106 0 15.157-0.938 11.84 8.436l-2.367 7.501h-31.266l-4.735 5.624h12.316l1.892 11.252c1.898 12.656 1.898 12.656 8.055 12.656 4.74 0 4.74-0.94 1.424 10.312l-2.847 9.375h-8.999c-15.631 0-18.473-2.342-21.32-18.28l-1.418-10.313-5.683 7.502c-15.636 21.091-16.58 21.56-36.476 21.56-12.794 0-12.794 0-10.897-3.75 0.475-1.873 0.475-1.873-3.316-1.873-3.79 0-3.79 0-4.738 2.812l-0.475 2.811H666.88l0.474-1.408c1.424-4.684 3.79-4.215-25.105-4.215-25.109 0-26.527 0-26.053-1.409l2.368-8.435c2.841-8.44 2.367-8.44 5.209-8.44 2.37 0 2.37 0 3.315-3.281 22.268-73.592 29.374-97.03 30.319-100.31l1.897-6.094h13.264c8.525 0 14.682 0.465 14.682 0.934z m-168.167 40.314l-5.213 16.406h-28.42c-2.842 9.375-3.79 12.187-4.266 13.125-0.474 1.409 0.475 1.409 14.214 1.409 8.054 0 14.686 0.47 14.686 0.47 0 0.464-0.474 1.402-0.95 2.81-0.473 0.935-1.422 4.686-2.365 8.436l-1.898 6.093H475.5l-3.316 11.252c-4.738 15.937-4.264 16.406 13.738 14.064 7.581-0.939 7.107-1.877 3.79 9.375l-2.841 9.374h-19.9c-31.263 0-31.737-0.939-23.212-27.658 2.372-8.436 4.74-15.468 4.74-15.468s-3.317-0.47-8.056-0.47c-4.26 0-8.05 0-8.05-0.469 3.315-11.716 4.734-15.468 4.734-16.406 0.474-0.934 1.423-1.403 8.53-1.403h8.05l3.79-14.534h-7.576c-5.688 0-7.58 0-7.58-0.939 0-0.933 4.264-14.528 4.733-15.937 0.95-0.933 72.483-0.469 72.008 0.47z m91.9 33.752c0 0.938-0.949 3.75-1.42 6.093-2.846 13.125-6.631 15.937-21.792 16.875-5.209 0.47-9.948 0.938-9.948 0.938-0.949 1.405-0.949 12.657 0 14.53l1.423 1.877 9.473-0.47c5.21-0.469 9.474-0.469 9.474-0.469 0 0.939-5.21 17.345-5.684 17.81-0.948 0.94-29.843 0.47-33.634-0.934-5.683-1.878-5.683-1.409-5.214-30.94l0.476-25.78h24.16v9.844h4.74c5.208 0 5.682-0.47 8.05-7.033l1.422-3.75h9.475c8.524 0.47 9.473 0.47 8.999 1.409z m44.53-200.626l-5.213 22.5h7.107c36.476 0.938 51.637-40.784 16.105-43.596-5.684-0.47-10.893-0.939-11.367-0.939-1.422 0-1.422 1.41-6.631 22.035z m-188.542 31.874c-8.999 3.75-17.524 37.501-10.417 42.656 5.208 4.22 12.79-2.812 16.58-14.529 6.158-21.565 4.26-31.878-6.163-28.127z m282.339 2.342c-9.478 4.69-16.58 37.971-9.478 41.721 9.478 5.155 21.794-12.654 21.794-31.877 0-8.905-5.214-13.125-12.316-9.844zM557.927 562.957l-2.368 8.436c-1.422 4.22-2.367 7.97-2.841 8.435 0 0.47 2.367-0.465 5.683-2.343 9.473-4.685 12.316-5.623 26.053-6.092l11.846-0.47c1.893-5.623 2.368-7.966 2.368-8.435 0.474-0.47-40.267-0.47-40.741 0.47z m-8.05 27.185l-1.899 7.5 40.741-0.47 2.368-7.5c-32.212 0-41.21 0-41.21 0.47z m128.848-16.876c-1.896 6.097-3.315 10.782-2.841 10.782l5.683-1.873c2.842-0.94 8.055-2.347 10.897-2.812 2.841-0.469 5.209-0.94 5.683-0.94 0 0 4.74-14.532 4.74-15.001 0 0-4.74-0.465-10.423-0.465H682.04l-3.316 10.31z m-7.58 23.907c0 0.469-1.893 5.159-3.317 10.782-1.892 5.624-3.315 10.783-3.315 10.783 0 0.465 2.367-0.47 5.683-1.878 3.316-1.403 8.055-2.812 10.897-3.28 6.157-0.94 6.631-1.404 7.107-3.751 0.474-0.935 1.422-4.685 2.366-7.497l1.898-5.628H682.04c-5.683 0-10.897 0-10.897 0.469z m-16.58 53.908l20.845 0.47c4.264-14.064 5.683-18.754 5.683-19.223l-20.844-0.934-5.684 19.687z"
						 fill="#FFFFFF" p-id="21735"></path>
					</svg>
					<svg t="1605175121730" v-if='item.type == "BALANCE"' class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12054"
					 width="32" height="32">
						<path d="M163.84 223.4368L663.06048 0 778.24 223.4368 355.81952 409.6z" fill="#85D8FF" p-id="12055"></path>
						<path d="M942.08 409.6h-163.84a81.92 81.92 0 0 0-81.92 81.92v245.76a81.92 81.92 0 0 0 81.92 81.92h163.84v122.88a81.92 81.92 0 0 1-81.92 81.92H81.92a81.92 81.92 0 0 1-81.92-81.92V286.72a81.92 81.92 0 0 1 81.92-81.92h778.24a81.92 81.92 0 0 1 81.92 81.92v122.88z"
						 fill="#4A90E2" p-id="12056"></path>
						<path d="M778.24 450.56h204.8a40.96 40.96 0 0 1 40.96 40.96v245.76a40.96 40.96 0 0 1-40.96 40.96h-204.8a40.96 40.96 0 0 1-40.96-40.96v-245.76a40.96 40.96 0 0 1 40.96-40.96z m81.92 204.8a40.96 40.96 0 1 0 0-81.92 40.96 40.96 0 0 0 0 81.92z"
						 fill="#4A90E2" p-id="12057"></path>
					</svg>
					<text style="margin-left: 10px;">{{item.name}}支付</text>
				</div>
				<div v-for='p in item.children' class='row_payway_item'>
					<div class="row_radio_name">
						<text style="margin-left: 5px;font-size: 14px;">{{p.name}}</text>
					</div>
					<div class='row_radio'>
						<label class="radio">
							<radio :value="p.value" :checked="p.checked" color="#78A8F2" /></label>
					</div>
				</div>
			</div>
		</radio-group>
		<view class='row_btn'><button class='btn' @click="recharge" :disabled="disabled">立即支付</button></view>
	</view>
</template>

<script>
	import pay from '@/utils/wxpayUtils.js'
	export default {
		data() {
			return {
				type: 'meal', 	//订单来源 meal--订购套餐 balance--余额套餐 post--支付邮费
				price: 0, 		//订单价格
				amount: 1, 		//连续充值次数
				dictIsPreStorage: '',//本月生效 or 次月生效
				setMealId: '',	//套餐id
				cardId: '',
				cardNumber: '8986062015000166250',
				balanceId: '',	//余额套餐id
				payway: [],
				checkedYE: '',
				payed: false,
				loading: false,
				disabled: false,
				wxFlag: false,//判断当前浏览器是否为微信浏览器
				pagekey:'',
				paymentId: '',
				wxType: '',
				androidFlag:false,
				paymentHeadId:null,
				payType:'',
				token:''
			}
		},
		async onLoad(option) {
			
			
			let token=uni.getStorageSync('custoken')
			
			uni.getStorage({
				key: 'custoken',
				success: function(v) {
					token = v.data
					console.log(token)
				}
			}) 
			this.token = token
			uni.showToast({
				title: this.payed,
				icon: 'none'
			})
			if(this.payed){
				uni.switchTab({
					url: '/pages/tabbar/cardList/index'
				});
			}
			this.cardNumber = option.cardNumber;
			this.cardId = option.cardId;
			this.price = option.price;
			this.type = option.type;
			this.balanceId = option.type == 'balance'?option.balanceId: '';
			
			this.amount = option.type == 'meal'?option.amount: '1';
			
			this.setMealId = option.type == 'meal'?option.setMealId: '';
			this.dictIsPreStorage = option.type == 'meal'?option.dictIsPreStorage: '';
			let idsStr = option.type == 'post'?option.ids: '';
		
			this.ids = idsStr?idsStr.split(','):[];
			this.address = option.type == 'post'?option.address: '';
			this.phoneNumber = option.type == 'post'?option.phoneNumber: '';
			this.receiveName = option.type == 'post'?option.receiveName: '';
			this.receiveName = option.type == 'post'?option.receiveName: '';
			
			this.pagekey = await this.$getPageKey();
			
		},
		onShow() {
			var ua = navigator.userAgent.toLowerCase();//获取判断用的对象
			//this.wxFlag = ua.match(/MicroMessenger/i) == "micromessenger"?true:false;
			if(ua.match(/MicroMessenger/i) == "micromessenger"){
				this.wxFlag=true
				this.androidFlag = false
				this.wxType = 'JSAPI'
				this.payType='JSAPI'
			}else/* if (sdAndroid!=undefined) */{
				this.wxFlag=false
				this.androidFlag = true
				this.paymentHeadId='2'
				this.wxType ='AND_PAY'
				this.payType='AND_PAY'
			}/* else{
				this.wxFlag=false
				this.androidFlag = false
				this.wxType ='H5'
				this.payType='H5'
			} */
			//this.wxType = ua.match(/MicroMessenger/i) == "micromessenger"?'JSAPI':'H5';
	
			this.getPayway();
		},
		methods: {
			//获取支付方式列表
			async getPayway() {
				let res = await this.$req.OEMSetting('payment/choosePayment', {
					dictPayTypeFlag: this.payType,
					paymentHeadId:this.paymentHeadId
				});
				this.payway = [
					{ name: '微信', type: 'WXZF', children: []},
					{ name: '支付宝', type: 'ZFBZF', children: []},
					{ name: '银联', type: 'UPSMZF', children: []},
					// { name: '余额', type: 'BALANCE', children: [{id:'',type: 'YE', name: '余额', checked: false}]}
				];
				if (res._result && res.data) {
					for (let item of res.data) {
						let obj = {};
						obj.value = item.id;
						obj.type = item.payType?item.payType:'WXZF';
						obj.name = item.paymentRealName;
						if(item.payType=='ZFBZF'){
							this.payway[1].children.push(obj);
						}
						else if(item.payType=='UPSMZF'){
							this.payway[2].children.push(obj);
						}
						else{
							this.payway[0].children.push(obj);
						}
					}
					
					if(this.payway[0].children){
						this.paymentId = this.payway[0].children[0].value;
						this.payway[0].children[0].checked = true;
					}
					else{
						if(this.payway[1].children){
							this.paymentId = this.payway[1].children[0].value;
							this.payway[1].children[0].checked = true;
						}
						else{
							this.paymentId = this.payway[2].children[0].value;
							this.payway[2].children[0].checked = true;
						}
					}
				}
			},
			//切换支付方式
			changePayWay(val){
				this.paymentId = val.detail.value;
			},
			//点击充值
			async recharge(){
				let _this = this;
				
				
				if(this.paymentId==''){
					this.$message("请选择一个付款方式！")
					return false
				}
				// this.pagekey = await this.$getPageKey();
				this.disabled = true;
				//订购套餐支付接口
				
				var param = {
					ids: this.ids,
					address: this.address,
					phoneNumber: this.phoneNumber,
					receiveName: this.receiveName,
					id: this.balanceId,
					amount: this.amount,
					dictIsPreStorage: this.dictIsPreStorage,
					dictPayTunnel: 'WX',
					setMealId: this.setMealId,
					cardId: this.cardId,
					cardNumber: this.cardNumber,
					paymentId: this.paymentId,
					type:this.type,
					token:''
					// pagekey: this.pagekey
				}
				if(this.payType=='AND_PAY'){
					//需要将数据拉到小程序中进行统一下单
					//param.type='meal'
					param.token = this.token
					let paramstr = JSON.stringify(param)
					sdAndroid.pay(paramstr)
					uni.showModal({
					    title: '提示',
					    content: '是否付款成功？',
					    success: function (res) {
					        if (res.confirm) {
								uni.switchTab({
									url: '/pages/tabbar/cardList/index'
								});
					            console.log('用户点击确定');
					        } else if (res.cancel) {
					            console.log('用户点击取消');
					        }
					    }
					});
					return 
				}
				
				if(this.type=='meal'){
			
						let obj = await this.$req.userRecharge('customer-order/createCustomerOrder', param)
						
						if(obj.data&&obj.data.wechatH5payUrl&&!_this.wxFlag){
							window.location.href = obj.data.wechatH5payUrl
						}/* else if(obj.data&&_this.androidFlag){
							sdAndroid.pay(JSON.stringify(obj.data))
						} */
						
						else{
							pay(obj.data, () => {
								_this.payed = true;
								
								setTimeout(()=>{
									if(obj.data.realNameUrl){
										window.location.href = obj.data.realNameUrl
									}
									else{
										uni.switchTab({
											url: '/pages/tabbar/cardList/index'
										});
									}
								},1000)
							})
						}
					
					
				}
				//订购余额套餐
				if(this.type=='balance'){
					this.$req.userRecharge('/balanceRecharge/createRechargeBalanceOrder', {
						id: this.balanceId,
						cardId: this.cardId,
						cardNumber:this.cardNumber,					
						paymentId: this.paymentId,
						// pagekey: this.pagekey
					}).then(obj => {
						if(obj.data&&obj.data.wechatH5payUrl&&!_this.wxFlag){
							window.location.href = obj.data.wechatH5payUrl
						}
						else{
							pay(obj.data, () => {
								this.$message("充值成功！")
								this.payed = true;
								uni.switchTab({
									url: '/pages/tabbar/cardList/index'
								});
							})
						}
					})
				}
				//支付邮费
				if(this.type=='post'){
					this.$req.userData('card/changeCardInformation/recheck',{
						ids: this.ids,
						address: this.address,
						phoneNumber: this.phoneNumber,
						receiveName: this.receiveName,
						paymentId: this.paymentId,
						pagkey: this.pagekey
					}).then(async obj=>{
						this.pagekey = await this.$getPageKey();
						//跳转到换卡记录
						uni.setStorage({
							key: 'tab',
							data: 'change'
						})
						if(obj.data&&obj.data.wechatH5payUrl&&!_this.wxFlag){
							window.location.href = obj.data.wechatH5payUrl
						}
						else if(this.price==0&&!obj.data.wechatH5payUrl&&!_this.wxFlag){
							uni.switchTab({
								url: '/pages/tabbar/order/orderList'
							})
							uni.showToast({
								title: '无链接',
								icon: 'error',
							})
						}
						else{
							pay(obj.data, () => {
								this.$message("付款成功！")
								uni.switchTab({
									url: '/pages/tabbar/order/orderList'
								})
								
							})
						}
					})
				}
				setTimeout(()=>{
					this.disabled = false;
				},1000)
				
			},
			
		},
	}
</script>

<style>
	::-webkit-scrollbar {
		display: none;
	}

	.content {
		width: 100%;
		height: 100%;
		position: absolute;
		top: 0;
		left: 0;
		overflow: scroll;
		background: #f2f2f2;
	}

	.row_head {
		width: 100%;
		height: 40vw;
		position: relative;
		top: 0;
		left: 0;
		text-align: center;
		align-items: 40vw;
		color: #1a1a1a;
		font-size: 20px;
		display: flex;
		flex-direction: column;
		flex-wrap: wrap;
		justify-content: center;
		align-items: center;
		align-content: center;
	}

	.row_price {
		width: 100%;
		height: 100upx;
		position: relative;
		top: 0;
		left: 0;
		text-align: center;
		line-height: 100upx;
		font-size: 40px;
		font-weight: 500;
	}

	.row_type {
		width: 100%;
		height: 60upx;
		position: relative;
		top: 0;
		left: 0;
		font-size: 14px;
		color: #666;
		font-weight: 100;
		line-height: 60upx;
	}

	.row_payway {
		width: 80%;
		height: auto;
		position: relative;
		top: 0;
		left: 10%;
		border: 1px solid #e6e6e6;
		border-radius: 5px;
		box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
		margin-bottom: 10px;
		background-color: #FFFFFF;
	}

	.row_payway_head {
		width: 94%;
		height: 100upx;
		position: relative;
		top: 0;
		left: 0;
		padding: 0 3%;
		font-size: 16px;
		display: flex;
		justify-content: flex-start;
		align-items: center;
		border-bottom: 1px solid #e6e6e6;
	}

	.row_payway_item {
		width: 90%;
		height: 80upx;
		position: relative;
		top: 0;
		left: 0;
		padding: 0 5%;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.row_radio_name {
		width: 70%;
		height: 80upx;
		position: relative;
		top: 0;
		left: 0;
		display: inline-flex;
		line-height: 80upx;
		justify-content: flex-start;
		align-items: center;
	}

	.row_radio {
		width: auto;
		margin: 0 5px;
		transform: scale(0.7);
	}

	.row_btn {
		width: 100%;
		height: auto;
		position: relative;
		top: 0;
		left: 0;
		padding: 60upx 0;
	}

	.btn {
		width: 80vw;
		height: 80upx;
		position: relative;
		top: 0;
		left: 0;
		border: none;
		background: linear-gradient(120deg, #A0C6FF 0%, #408CFF 100%);
		color: #fff;
		font-size: 14px;
		letter-spacing: 1px;
		line-height: 80upx;
	}
	.textButton{
		font-size: 14px;
		color: #78A8F2;
		margin-left: 5px;
		font-weight: bold;
	}
	
</style>
